<template>
	<view class="container">
		<view class="layout">
			<view class="list-warp">
				<view class="list-item">
					<view class="left">
						<view class="headpic">
							<image class="pic" :src="state.obj.user.avatar_url"></image>
						</view>
						<view class="info">
							<view class="label">
								<text class="h4">{{ state.obj.user.nickname }}</text>
								<text class="tag">已激活</text>
							</view>
							<view class="mobile">{{ state.obj.user.tel }}</view>
						</view>
					</view>
					<view class="right">
						<view class="money">+¥ {{ state.obj.price }}</view>
						<view class="time">{{ state.obj.user.created_at }}</view>
					</view>
				</view>
			</view>
			<view class="body">
				<view class="h3">会员信息：</view>
				<view class="msg">
					<view class="label">姓名</view>
					<view class="text">{{ state.obj.nickname }}</view>
				</view>
				<view class="msg">
					<view class="label">手机</view>
					<view class="text">{{ state.obj.tel }}</view>
				</view>
				<view class="msg">
					<view class="label">地址</view>
					<view class="text">{{ state.obj.address }}</view>
				</view>
				<view class="msg">
					<view class="label">激活时间</view>
					<view class="text">{{ dayjs(state.obj.time_jihuo).format('YYYY年MM月DD日') }}</view>
				</view>
				<view class="msg">
					<view class="label">手机串码</view>
					<view class="text">{{ state.obj.imei }}</view>
				</view>
				<view class="msg">
					<view class="label">代理商编码</view>
					<view class="text">{{ state.obj.agent_number }}</view>
				</view>
				<view class="msg">
					<view class="label">兑换码</view>
					<view class="text">{{ state.obj.change_code }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { get } from '@/request/index.js';
import { dayjs } from '../../static/dayjs.min';

const state = reactive({
	obj: {}
});

onLoad((option) => {
	getDetailData(option.id);
});

const getDetailData = async (id) => {
	uni.showLoading({
		title: '数据请求中···'
	});
	const res = await get('agent/center/price_detail', { id });
	const { code, data } = res;
	if (code == 200) {
		state.obj = data;
	}
	uni.hideLoading();
};
</script>

<style scoped lang="scss">
.list-warp {
	margin-bottom: 20rpx;
}
.list-item {
	border-bottom: none !important;
}
</style>
